<?php

include dirname(dirname(dirname(__FILE__))) . '/include/common.php';

class webServiceGetGuest extends core {

    public function process() {
        $guest_id = $this->db->escape(trim($_POST['guest_id']));
        $user_id = intval($_POST['user_id']);
        $data = $this->db->get_row("SELECT * FROM guests WHERE guest_id=$guest_id AND `user_id`='$user_id'");
        if ($data) {
            if($data->fbid==""){
                $guest_face=0;
            }else{
                $guest_face=1;
            }
            $this->_JSONResponse(array('error' => 0, 'firstname' => $data->firstname, 'lastname' => $data->lastname, 'email' => $data->email,
                'phone' => $data->phone, 'address' => $data->address, 'city' => $data->city, 'state' => $data->state,
                'zipcode' => $data->zipcode,'guest_face'=>$guest_face));
        } else {
            $this->_JSONResponse(array('error' => 1,'msg'=>"This guest does not exist!"));
        }
    }

}

$processor = new webServiceGetGuest();
$processor->process();
?>